<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
		<button @click="toUpload()">点击上传</button>
		
		<image v-if="imgUrl!==''" class="logoTwo" :src='imgUrl'></image>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '图片裁剪演示',
				imgUrl: '',
			}
		},
		onLoad() {
			this.imgUrl = ''
		},
		onShow(){
			this.imgUrl = uni.getStorageSync('fileUrl')
		},
		methods: {
			toUpload(item) {
				var that = this
				uni.chooseImage({
					count: 1,
					sizeType: ['original', 'compressed'],
					sourceType: ['album', 'camera'],
					success: function(res) {
						const tempFilePaths = res.tempFilePaths
						uni.navigateTo({
							url: '/pages/imgCutVip/main?url=' + tempFilePaths
						})
					}
				})
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}
	
	.logoTwo {
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
